package cn.maihe.elg.operation.model.enums;

import java.util.Arrays;

/**
 * @Description 合同状态；CREATED-已创建 SIGNING-签署中 REJECTED-已拒签 OVERDUE-已逾期  FINISHED-已完成
 * @Author WJH
 * @Date 2021/08/12
 */
public enum ContractStatus {
    DRAFTING("起草中"),
    CANCEL("已撤销"),
    CREATED("已创建"),
    SIGNING("签署中"),
    REJECTED("已拒签"),
    OVERDUE("已逾期"),
    FINISHED("已完成"),

    ;
    private String desc;

    ContractStatus(String desc) {
        this.desc = desc;
    }

    public String getDesc() {
        return desc;
    }

    public static ContractStatus resolve(String status){
        return  Arrays.stream(values()).filter(o -> o.name().equals(status)).findFirst().orElseThrow(() -> new RuntimeException("状态[" + status + "]值错误"));
    }
}
